<template>
  <div class="q-input">
    <el-input v-model="inputValue" :maxlength="maxlength"></el-input>
  </div>
</template>

<script>
export default {
  name: "Qinput",
  model: {
    prop: "value", //处理v-model数据
    event: "msg",
  },
  props: {
    value: [String, Number],
    reg: [String],
    maxlength: {
      type: [String, Number],
      default: "20",
    },
    isSymbol: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      inputValue: this.value,
    };
  },
  watch: {
    inputValue(val) {
      let that = this;
      let reg = that.reg;
      let isSymbol = that.isSymbol;
      console.log(val);
      if (val) {
        that.inputValue = this.inputReg(val, reg, isSymbol);
      }
    },
  },
};
</script>

<style lang='scss' scoped>
.q-input {
  // display: inline-block;
}
</style>